###
 # @Description: 
 # @Version: 2.0
 # @Autor: gang
 # @Date: 2020-09-10 11:29:33
 # @LastEditors: gang
 # @LastEditTime: 2020-09-23 09:45:03
### 
#!/bin/bash
    #system runing info
    #Now system runing Times
    #CPU info
    CPU_INFO=$(top -n1 |grep "Cpu(s):" |awk '{print echo "CPU使用率(%):"$2 echo "%"}')
    #Disk info
    DISK_INFO=$(df -hT |grep /dev/sda1 |awk '{print echo "硬盘使用率(%):"$6}')
    #Mem Info
    Mem_INFO=$(free -h |grep Mem |awk '{print echo "剩余内存:"$7}')
    #80
    # Prot=$(nmap 127.0.0.1 |grep 80 |awk '{print $2}')
    #3306
    # Prot1=$(nmap 127.0.0.1 |grep 3306 |awk '{print $2}')
    #dateTime
    Time=$(date +%F)
    #UPTIME   #这是系统已经运行时间代码，脚本放在下面
    uptimes=$(cat /proc/uptime | awk '{D=$1/86400;H=($1%86400)/3600;M=($1%3600)/60;S=+$1%60;printf("系统已运行：%d天%d小时%d分%d秒\n",D,H,M,S)}')
    #FuZai
    local=$(uptime |awk '{print $8,$9,$10,$11,$12}')
    #系统在线用户
    vu=$(who |wc -l)
    upname=$(who |awk '{print echo "用户名:"$1,   echo "IP:"$5}')
    #统计进程数
    run=$(ps -aux |wc -l)
    #输出
    echo "当前主机名:$(hostname)                                                      "
    echo "------------------------------------------------------------------------  "
    echo ${CPU_INFO}
    # echo "------------------------------------------------------------------------  "
    echo ${DISK_INFO}
    # echo "------------------------------------------------------------------------  "
    echo Web:${Prot}
    # echo "------------------------------------------------------------------------"
    echo ${Mem_INFO}
    # echo "------------------------------------------------------------------------"
    echo ${uptimes}
    # echo "------------------------------------------------------------------------"
    echo 系统负载:${local}
    echo "------------------------------------------------------------------------"